<meta id="websocket-data" data-websocket="{{ websocket }}">

<script src="/manx/js/xterm.js"></script>
<script src="/manx/js/terminal.js"></script>
<link rel="stylesheet" href="/manx/css/basic.css">
<link rel="stylesheet" href="/manx/css/xterm.css"/>

<div id="manx-section-intro" class="section-profile">
    <div class="row" style="background-image: url('/manx/img/manx.png');">
        <div class="topleft duk-icon"><img onclick="removeSection('manx-section-intro')" src="/gui/img/x.png"></div>
        <div class="column" style="flex:40%;padding:15px;text-align: left">
            <h1 style="font-size:70px;margin-top:-20px;">Manx</h1>
            <h2 style="margin-top:-55px">a coordinated access trojan (CAT)</h2>
            <p style="width:40%;font-size:15px;">
                The Manx agent, written in GoLang, connects to the server over the TCP <i>contact point</i>.
                This raw TCP socket connection allows Manx to keep a persistent connection between host-and-server.
                Bundled with Manx is a reverse-shell management tool, called the <i>terminal</i>
                - below - which allows you to establish a local shell on an agent.
            </p>
            <h5>To deploy a Manx agent, go to the Agents tab</h5>
         </div>
    </div>
</div>

<div id="terminal-section" class="section-profile">
    <div class="row">
         <div class="topleft duk-icon"><img onclick="removeSection('terminal-section')" src="/gui/img/x.png"></div>
         <div class="column" style="flex:100%;padding:15px;text-align: left">
             <div id="filters">
                <center>
                    <table class="ability-filter" frame=void rules=rows style="border-spacing:5px;width:100%">
                    <tr>
                        <td>
                        <select id="session-id"  onchange="getAbilities();clearTerminal();getShellHistory(this);">
                             <option value="" disabled selected>Select a session</option>
                             {% for s in sessions %}
                                 <option value="{{ s.id }}" data-paw="{{ s.info }}" data-platform="{{ s.platform }}" data-executor="{{ s.executors[0] }}">{{ s.id }} - {{ s.info }}</option>
                             {% endfor %}
                        </select>
                        </td>
                        <td>
                         <select id="tactic-filter" onchange="filterTechniques()">
                             <option value="" disabled selected>Select a tactic</option>
                         </select>
                        </td>
                        <td>
                        <select id="technique-filter" onchange="filterProcedures()">
                            <option value="" disabled selected>Select a technique</option>
                        </select>
                        </td>
                        <td>
                        <select id="procedure-filter" onchange="showProcedure()">
                            <option value="" disabled selected>Select a procedure</option>
                        </select>
                        </td>
                    </tr>
                </table>
                </center>
             </div>
             <br>
             <div id="xterminal"></div>
         </div>
    </div>
</div>

<script>
    let refresher = setInterval(refresh, 10000);
    $('.section-profile').bind('destroyed', function() {
        clearInterval(refresher);
    });
    stream('Deploy a Manx agent and a session will appear in the list');

    function refresh(){
        function refreshSessions(data){
            data.forEach(function(s) {
                let found = false;
                $("#session-id > option").each(function() {
                    if($(this).data('paw') === s.info) {
                        found = true;
                    }
                });
                if(!found){
                    stream('New TCP session established: '+ s.info);
                    $('#session-id').append('<option value="'+s.id+'" data-paw="'+s.info+'">'+s.id+' - '+s.info+'</option>');
                }
            });
        }
        restRequest('POST', null, refreshSessions, '/plugin/manx/sessions')
    }
    //# sourceURL=manx.js
</script>